]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Remove our own font DPI resolution implementation
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 26 Mar 2012 14:14:31 +0000 (11:14 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 18 May 2012 17:57:12 +0000 (13:57 -0400)
Clutter has had clutter_backend_get_resolution for a little while.

https://bugzilla.gnome.org/show_bug.cgi?id=672807

src/shell-global.c
src/st/st-theme-context.c
src/st/st-theme-context.h
src/st/st-theme-node.c
src/st/test-theme.c

index 0a5ce864ef158c31d64c383dc571df41697d0315..be14fa3b212672859cd0ff98fa9badd3524eab1e 100644 (file)
@@ -805,38 +805,9 @@ global_stage_after_paint (ClutterStage *stage,
                         "clutter.stagePaintDone");
 }
 
-static void
-update_font_options (GtkSettings  *settings,
-                     ClutterStage *stage)
-{
-  StThemeContext *context;
-  gint dpi;
-
-  g_object_get (settings,
-                "gtk-xft-dpi", &dpi,
-                NULL);
-
-  context = st_theme_context_get_for_stage (stage);
-
-  if (dpi != -1)
-    /* GTK stores resolution as 1024 * dots/inch */
-    st_theme_context_set_resolution (context, dpi / 1024);
-  else
-    st_theme_context_set_default_resolution (context);
-}
-
-static void
-settings_notify_cb (GtkSettings *settings,
-                    GParamSpec  *pspec,
-                    gpointer     data)
-{
-  update_font_options (settings, CLUTTER_STAGE (data));
-}
-
 static void
 shell_fonts_init (ClutterStage *stage)
 {
-  GtkSettings *settings;
   CoglPangoFontMap *fontmap;
 
   /* Disable text mipmapping; it causes problems on pre-GEM Intel
@@ -846,13 +817,6 @@ shell_fonts_init (ClutterStage *stage)
    */
   fontmap = COGL_PANGO_FONT_MAP (clutter_get_font_map ());
   cogl_pango_font_map_set_use_mipmapping (fontmap, FALSE);
-
-  settings = gtk_settings_get_default ();
-  g_object_connect (settings,
-                    "signal::notify::gtk-xft-dpi",
-                    G_CALLBACK (settings_notify_cb), stage,
-                    NULL);
-  update_font_options (settings, stage);
 }
 
 /* This is an IBus workaround. The flow of events with IBus is that every time
index 7b676b7f79017752071bea7122066c686b0a4aed..a73679eb503782522457e0c56e6b32fa138b79f2 100644 (file)
@@ -28,7 +28,6 @@
 struct _StThemeContext {
   GObject parent;
 
-  double resolution;
   PangoFontDescription *font;
   StThemeNode *root_node;
   StTheme *theme;
@@ -38,7 +37,6 @@ struct _StThemeContextClass {
   GObjectClass parent_class;
 };
 
-#define DEFAULT_RESOLUTION 96.
 #define DEFAULT_FONT "sans-serif 10"
 
 enum
@@ -93,7 +91,6 @@ st_theme_context_class_init (StThemeContextClass *klass)
 static void
 st_theme_context_init (StThemeContext *context)
 {
-  context->resolution = DEFAULT_RESOLUTION;
   context->font = pango_font_description_from_string (DEFAULT_FONT);
 
   g_signal_connect (st_texture_cache_get_default (),
@@ -232,66 +229,6 @@ st_theme_context_get_theme (StThemeContext *context)
   return context->theme;
 }
 
-/**
- * st_theme_context_set_resolution:
- * @context: a #StThemeContext
- * @resolution: resolution of the context (number of pixels in an "inch")
- *
- * Sets the resolution of the theme context. This is the scale factor
- * used to convert between points and the length units pt, in, and cm.
- * This does not necessarily need to correspond to the actual number
- * resolution of the device. A value of 72. means that points and
- * pixels are identical. The default value is 96.
- */
-void
-st_theme_context_set_resolution (StThemeContext *context,
-                                 double          resolution)
-{
-  g_return_if_fail (ST_IS_THEME_CONTEXT (context));
-
-  if (resolution == context->resolution)
-    return;
-
-  context->resolution = resolution;
-  st_theme_context_changed (context);
-}
-
-/**
- * st_theme_context_set_default_resolution:
- * @context: a #StThemeContext
- *
- * Sets the resolution of the theme context to the default value of 96.
- * See st_theme_context_set_resolution().
- */
-void
-st_theme_context_set_default_resolution (StThemeContext *context)
-{
-  g_return_if_fail (ST_IS_THEME_CONTEXT (context));
-
-  if (context->resolution == DEFAULT_RESOLUTION)
-    return;
-
-  context->resolution = DEFAULT_RESOLUTION;
-  st_theme_context_changed (context);
-}
-
-/**
- * st_theme_context_get_resolution:
- * @context: a #StThemeContext
- *
- * Gets the current resolution of the theme context.
- * See st_theme_context_set_resolution().
- *
- * Return value: the resolution (in dots-per-"inch")
- */
-double
-st_theme_context_get_resolution (StThemeContext *context)
-{
-  g_return_val_if_fail (ST_IS_THEME_CONTEXT (context), DEFAULT_RESOLUTION);
-
-  return context->resolution;
-}
-
 /**
  * st_theme_context_set_font:
  * @context: a #StThemeContext
index 8805fb19b0b061b26692f1ebfac7158f91f55d9d..a0b73d9ff94c43dc4acce1a91c2a082b92c87634 100644 (file)
@@ -56,10 +56,6 @@ void                        st_theme_context_set_theme      (StThemeContext
                                                              StTheme                    *theme);
 StTheme *                   st_theme_context_get_theme      (StThemeContext             *context);
 
-void                        st_theme_context_set_resolution (StThemeContext             *context,
-                                                             gdouble                     resolution);
-void                        st_theme_context_set_default_resolution (StThemeContext *context);
-double                      st_theme_context_get_resolution (StThemeContext             *context);
 void                        st_theme_context_set_font       (StThemeContext             *context,
                                                              const PangoFontDescription *font);
 const PangoFontDescription *st_theme_context_get_font       (StThemeContext             *context);
index 47b117c2f957f138881a5f2d84b8abb781e726ab..765a3ee66c449324076733a6a581c7a76e7dc318 100644 (file)
@@ -820,7 +820,7 @@ get_length_from_term (StThemeNode *node,
       break;
     case POINTS:
       {
-        double resolution = st_theme_context_get_resolution (node->context);
+        double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
         *length = num->val * multiplier * (resolution / 72.);
       }
       break;
@@ -842,7 +842,7 @@ get_length_from_term (StThemeNode *node,
           }
         else
           {
-            double resolution = st_theme_context_get_resolution (node->context);
+            double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
             *length = num->val * multiplier * (resolution / 72.) * font_size;
           }
       }
@@ -2139,7 +2139,7 @@ font_size_from_term (StThemeNode *node,
 {
   if (term->type == TERM_IDENT)
     {
-      double resolution = st_theme_context_get_resolution (node->context);
+      double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
       /* We work in integers to avoid double comparisons when converting back
        * from a size in pixels to a logical size.
        */
@@ -2346,7 +2346,7 @@ st_theme_node_get_font (StThemeNode *node)
   parent_size = pango_font_description_get_size (node->font_desc);
   if (!pango_font_description_get_size_is_absolute (node->font_desc))
     {
-      double resolution = st_theme_context_get_resolution (node->context);
+      double resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
       parent_size *= (resolution / 72.);
     }
 
index d6a8f7b3e71338956f5eee7827beb70a793d986c..fa85ebea5ae7c0b1d2b310c2e6f5dff676523e8d 100644 (file)
@@ -435,7 +435,6 @@ main (int argc, char **argv)
   stage = clutter_stage_new ();
   context = st_theme_context_get_for_stage (CLUTTER_STAGE (stage));
   st_theme_context_set_theme (context, theme);
-  st_theme_context_set_resolution (context, 96.);
   st_theme_context_set_font (context,
                                pango_font_description_from_string ("sans-serif 12"));